{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "138e6152",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "a7c9a659",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = pd.Series([1,2,3,4],index=['a','b','c','d'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "3b91285d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.series.Series'>\n"
     ]
    }
   ],
   "source": [
    "print(type(s1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "fac84055",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "f448ec93",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a\n",
      "b\n",
      "c\n",
      "d\n"
     ]
    }
   ],
   "source": [
    "for i in s1.index:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "46dfd17b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 2, 3, 4], dtype=int64)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "6672dc2e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1['c']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "881ca761",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Series({'a':1,'b':2,'c':3})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8104427e",
   "metadata": {},
   "outputs": [],
   "source": [
    "data = {'name':['zs','ls','ww'],'age':[20,22,21]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "a1459127",
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = pd.DataFrame(data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "1ef56ec6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "print(type(df1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c83caed7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  name  age\n",
      "0   zs   20\n",
      "1   ls   22\n",
      "2   ww   21\n"
     ]
    }
   ],
   "source": [
    "print(df1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6225e4c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "s2 = df1['name']\n",
    "s3 = df1['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "816b2e5e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(s2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "9aa25477",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    zs\n",
       "1    ls\n",
       "2    ww\n",
       "Name: name, dtype: object"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "eea366de",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    20\n",
       "1    22\n",
       "2    21\n",
       "Name: age, dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "9f1efb3a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  col1\n",
      "0   zs\n",
      "1   ls\n",
      "2   ww\n"
     ]
    }
   ],
   "source": [
    "print(pd.DataFrame({\"col1\":s2}))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "614c8980",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "print(type(pd.DataFrame({\"col1\":s2})))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "9aaa8e1a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  name  age\n",
      "0   zs   20\n",
      "1   ls   22\n",
      "2   ww   21\n"
     ]
    }
   ],
   "source": [
    "print(df1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "741bf283",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>zs</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>ww</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  name  age\n",
       "0   zs   20\n",
       "2   ww   21"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.loc[0::2,['name','age']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "a799da69",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>zs</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>ls</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>ww</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  name  age\n",
       "0   zs   20\n",
       "1   ls   22\n",
       "2   ww   21"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "560dc839",
   "metadata": {},
   "outputs": [],
   "source": [
    "stu_df = pd.read_csv(\"../data/students.txt\",encoding='utf8',names=[\"id\",'name','age','gender','clazz'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "3f9ce1ce",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>理科五班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name  age gender clazz\n",
       "0  1500100001  施笑槐   22      女  文科六班\n",
       "1  1500100002  吕金鹏   24      男  文科六班\n",
       "2  1500100003  单乐蕊   22      女  理科六班\n",
       "3  1500100004  葛德曜   24      男  理科三班\n",
       "4  1500100005  宣谷芹   22      女  理科五班"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "325b0265",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1000 entries, 0 to 999\n",
      "Data columns (total 5 columns):\n",
      " #   Column  Non-Null Count  Dtype \n",
      "---  ------  --------------  ----- \n",
      " 0   id      1000 non-null   int64 \n",
      " 1   name    1000 non-null   object\n",
      " 2   age     1000 non-null   int64 \n",
      " 3   gender  1000 non-null   object\n",
      " 4   clazz   1000 non-null   object\n",
      "dtypes: int64(2), object(3)\n",
      "memory usage: 39.2+ KB\n"
     ]
    }
   ],
   "source": [
    "stu_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "1463e140",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1.000000e+03</td>\n",
       "      <td>1000.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>22.521000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>2.888194e+02</td>\n",
       "      <td>1.113013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.500100e+09</td>\n",
       "      <td>21.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.500100e+09</td>\n",
       "      <td>22.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>22.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>24.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>1.500101e+09</td>\n",
       "      <td>24.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 id          age\n",
       "count  1.000000e+03  1000.000000\n",
       "mean   1.500101e+09    22.521000\n",
       "std    2.888194e+02     1.113013\n",
       "min    1.500100e+09    21.000000\n",
       "25%    1.500100e+09    22.000000\n",
       "50%    1.500101e+09    22.000000\n",
       "75%    1.500101e+09    24.000000\n",
       "max    1.500101e+09    24.000000"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "a6b240b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1500100016</td>\n",
       "      <td>潘访烟</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>1500100037</td>\n",
       "      <td>顾向松</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>1500100055</td>\n",
       "      <td>卫鸿熙</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>68</th>\n",
       "      <td>1500100069</td>\n",
       "      <td>束采波</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>81</th>\n",
       "      <td>1500100082</td>\n",
       "      <td>凌思菱</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>950</th>\n",
       "      <td>1500100951</td>\n",
       "      <td>平彭泽</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>956</th>\n",
       "      <td>1500100957</td>\n",
       "      <td>杜易云</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>972</th>\n",
       "      <td>1500100973</td>\n",
       "      <td>钮幼南</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>1500100985</td>\n",
       "      <td>申飞珍</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>985</th>\n",
       "      <td>1500100986</td>\n",
       "      <td>左天曼</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>72 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz\n",
       "15   1500100016  潘访烟   23      女  文科一班\n",
       "36   1500100037  顾向松   22      女  文科一班\n",
       "54   1500100055  卫鸿熙   24      男  文科一班\n",
       "68   1500100069  束采波   22      女  文科一班\n",
       "81   1500100082  凌思菱   22      女  文科一班\n",
       "..          ...  ...  ...    ...   ...\n",
       "950  1500100951  平彭泽   22      男  文科一班\n",
       "956  1500100957  杜易云   21      女  文科一班\n",
       "972  1500100973  钮幼南   23      女  文科一班\n",
       "984  1500100985  申飞珍   21      女  文科一班\n",
       "985  1500100986  左天曼   22      女  文科一班\n",
       "\n",
       "[72 rows x 5 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 过滤\n",
    "stu_df[stu_df['clazz'] == '文科一班']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "50c1e995",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1500100007</td>\n",
       "      <td>尚孤风</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1500100013</td>\n",
       "      <td>逯君昊</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科二班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1500100016</td>\n",
       "      <td>潘访烟</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>985</th>\n",
       "      <td>1500100986</td>\n",
       "      <td>左天曼</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>986</th>\n",
       "      <td>1500100987</td>\n",
       "      <td>双昆杰</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科四班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>987</th>\n",
       "      <td>1500100988</td>\n",
       "      <td>余鸿云</td>\n",
       "      <td>22</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>23</td>\n",
       "      <td>女</td>\n",
       "      <td>文科五班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>522 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz\n",
       "0    1500100001  施笑槐   22      女  文科六班\n",
       "1    1500100002  吕金鹏   24      男  文科六班\n",
       "6    1500100007  尚孤风   23      女  文科六班\n",
       "12   1500100013  逯君昊   24      男  文科二班\n",
       "15   1500100016  潘访烟   23      女  文科一班\n",
       "..          ...  ...  ...    ...   ...\n",
       "985  1500100986  左天曼   22      女  文科一班\n",
       "986  1500100987  双昆杰   24      男  文科四班\n",
       "987  1500100988  余鸿云   22      男  文科六班\n",
       "995  1500100996  厉运凡   24      男  文科三班\n",
       "998  1500100999  钟绮晴   23      女  文科五班\n",
       "\n",
       "[522 rows x 5 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_df[stu_df['clazz'].str.startswith(\"文科\")]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "28902e76",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>clazz</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科六班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1500100013</td>\n",
       "      <td>逯君昊</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>文科二班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>1500100019</td>\n",
       "      <td>娄曦之</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科三班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>1500100028</td>\n",
       "      <td>幸浩邈</td>\n",
       "      <td>24</td>\n",
       "      <td>男</td>\n",
       "      <td>理科五班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>977</th>\n",
       "      <td>1500100978</td>\n",
       "      <td>郜昆卉</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>文科五班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>981</th>\n",
       "      <td>1500100982</td>\n",
       "      <td>钱若芹</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科二班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>984</th>\n",
       "      <td>1500100985</td>\n",
       "      <td>申飞珍</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>文科一班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>992</th>\n",
       "      <td>1500100993</td>\n",
       "      <td>衡从蕾</td>\n",
       "      <td>21</td>\n",
       "      <td>女</td>\n",
       "      <td>理科二班</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "      <td>理科六班</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name  age gender clazz\n",
       "1    1500100002  吕金鹏   24      男  文科六班\n",
       "3    1500100004  葛德曜   24      男  理科三班\n",
       "12   1500100013  逯君昊   24      男  文科二班\n",
       "18   1500100019  娄曦之   24      男  理科三班\n",
       "27   1500100028  幸浩邈   24      男  理科五班\n",
       "..          ...  ...  ...    ...   ...\n",
       "977  1500100978  郜昆卉   21      男  文科五班\n",
       "981  1500100982  钱若芹   21      女  理科二班\n",
       "984  1500100985  申飞珍   21      女  文科一班\n",
       "992  1500100993  衡从蕾   21      女  理科二班\n",
       "996  1500100997  陶敬曦   21      男  理科六班\n",
       "\n",
       "[1000 rows x 5 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 排序\n",
    "stu_df.sort_values(['age','id'],ascending=[False,True])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c9725581",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 分组 聚合\n",
    "# 统计班级人数\n",
    "clazz_cnt = stu_df.groupby('clazz')['id'].count().reset_index().rename(columns={'id':'cnt'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "633d0e02",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   clazz  cnt\n",
      "0   文科一班   72\n",
      "1   文科三班   94\n",
      "2   文科二班   87\n",
      "3   文科五班   84\n",
      "4   文科六班  104\n",
      "5   文科四班   81\n",
      "6   理科一班   78\n",
      "7   理科三班   68\n",
      "8   理科二班   79\n",
      "9   理科五班   70\n",
      "10  理科六班   92\n",
      "11  理科四班   91\n"
     ]
    }
   ],
   "source": [
    "print(clazz_cnt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "df92ef17",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "print(type(clazz_cnt))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "756e0da2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clazz</th>\n",
       "      <th>cnt</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>72</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>94</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>84</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>104</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>文科四班</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>理科一班</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>理科三班</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>理科二班</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>理科五班</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>理科六班</td>\n",
       "      <td>92</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>理科四班</td>\n",
       "      <td>91</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   clazz  cnt\n",
       "0   文科一班   72\n",
       "1   文科三班   94\n",
       "2   文科二班   87\n",
       "3   文科五班   84\n",
       "4   文科六班  104\n",
       "5   文科四班   81\n",
       "6   理科一班   78\n",
       "7   理科三班   68\n",
       "8   理科二班   79\n",
       "9   理科五班   70\n",
       "10  理科六班   92\n",
       "11  理科四班   91"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clazz_cnt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "de0ba234",
   "metadata": {},
   "outputs": [],
   "source": [
    "clazz_max_age = stu_df.groupby('clazz')['age'].max().reset_index().rename(columns={'age':'max_age'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "a6a2e09c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>clazz</th>\n",
       "      <th>max_age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>文科一班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>文科三班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>文科二班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>文科五班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>文科六班</td>\n",
       "      <td>24</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  clazz  max_age\n",
       "0  文科一班       24\n",
       "1  文科三班       24\n",
       "2  文科二班       24\n",
       "3  文科五班       24\n",
       "4  文科六班       24"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "clazz_max_age.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "bf8f064a",
   "metadata": {},
   "outputs": [],
   "source": [
    "score_df = pd.read_csv(\"../data/score.txt\",encoding='utf8',names=['id','subject_id','score'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "d05471a4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>subject_id</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000001</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000002</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000003</td>\n",
       "      <td>137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000004</td>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000005</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>1000006</td>\n",
       "      <td>52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>1000001</td>\n",
       "      <td>139</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>1000002</td>\n",
       "      <td>102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>1000003</td>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>1000004</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id  subject_id  score\n",
       "0  1500100001     1000001     98\n",
       "1  1500100001     1000002      5\n",
       "2  1500100001     1000003    137\n",
       "3  1500100001     1000004     29\n",
       "4  1500100001     1000005     85\n",
       "5  1500100001     1000006     52\n",
       "6  1500100002     1000001    139\n",
       "7  1500100002     1000002    102\n",
       "8  1500100002     1000003     44\n",
       "9  1500100002     1000004     18"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score_df.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "17085a09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>subject_id</th>\n",
       "      <th>score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5990</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>1000003</td>\n",
       "      <td>102</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5991</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>1000004</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5992</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>1000005</td>\n",
       "      <td>41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5993</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>1000006</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5994</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>1000001</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5995</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>1000002</td>\n",
       "      <td>78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5996</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>1000003</td>\n",
       "      <td>81</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5997</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>1000007</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5998</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>1000008</td>\n",
       "      <td>87</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>1000009</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              id  subject_id  score\n",
       "5990  1500100999     1000003    102\n",
       "5991  1500100999     1000004     48\n",
       "5992  1500100999     1000005     41\n",
       "5993  1500100999     1000006     10\n",
       "5994  1500101000     1000001    100\n",
       "5995  1500101000     1000002     78\n",
       "5996  1500101000     1000003     81\n",
       "5997  1500101000     1000007      5\n",
       "5998  1500101000     1000008     87\n",
       "5999  1500101000     1000009     28"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score_df.tail(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "e864ab26",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 学生总分\n",
    "stu_sum_score_df = score_df.groupby(['id'])['score'].agg('sum').reset_index().rename(columns={'score':'sum_score'})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "2218ae0d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id  sum_score\n",
       "0  1500100001        406\n",
       "1  1500100002        440\n",
       "2  1500100003        359\n",
       "3  1500100004        421\n",
       "4  1500100005        395"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_sum_score_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "0a84cecf",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 关联\n",
    "# merge\n",
    "# how : left right inner\n",
    "# 每个学生总成绩：id,name,clazz,sum_score\n",
    "stu_sum_score = stu_df.merge(stu_sum_score_df,left_on='id',right_on='id',how='inner')[['id','name','clazz','sum_score']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "8f80369f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>clazz</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           id name clazz  sum_score\n",
       "0  1500100001  施笑槐  文科六班        406\n",
       "1  1500100002  吕金鹏  文科六班        440\n",
       "2  1500100003  单乐蕊  理科六班        359\n",
       "3  1500100004  葛德曜  理科三班        421\n",
       "4  1500100005  宣谷芹  理科五班        395"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_sum_score.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "beb62324",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 拼接\n",
    "stu_sum_score_10 = stu_sum_score.loc[:9,]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "c507622b",
   "metadata": {},
   "outputs": [],
   "source": [
    "stu_sum_score_10_tail = stu_sum_score.loc[len(stu_sum_score)-10::,]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "c73b9eed",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>clazz</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>990</th>\n",
       "      <td>1500100991</td>\n",
       "      <td>冉飞昂</td>\n",
       "      <td>理科一班</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>991</th>\n",
       "      <td>1500100992</td>\n",
       "      <td>莫运盛</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>992</th>\n",
       "      <td>1500100993</td>\n",
       "      <td>衡从蕾</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>993</th>\n",
       "      <td>1500100994</td>\n",
       "      <td>相凌青</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>994</th>\n",
       "      <td>1500100995</td>\n",
       "      <td>寿芷卉</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>355</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>1500100998</td>\n",
       "      <td>容昆宇</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>398</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>379</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name clazz  sum_score\n",
       "990  1500100991  冉飞昂  理科一班         76\n",
       "991  1500100992  莫运盛  理科六班        407\n",
       "992  1500100993  衡从蕾  理科二班        386\n",
       "993  1500100994  相凌青  理科四班        310\n",
       "994  1500100995  寿芷卉  理科五班        227\n",
       "995  1500100996  厉运凡  文科三班        355\n",
       "996  1500100997  陶敬曦  理科六班        293\n",
       "997  1500100998  容昆宇  理科四班        398\n",
       "998  1500100999  钟绮晴  文科五班        371\n",
       "999  1500101000  符瑞渊  理科六班        379"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_sum_score_10_tail"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "fe94858c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>clazz</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1500100006</td>\n",
       "      <td>边昂雄</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1500100007</td>\n",
       "      <td>尚孤风</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>418</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>1500100008</td>\n",
       "      <td>符半双</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>1500100009</td>\n",
       "      <td>沈德昌</td>\n",
       "      <td>理科一班</td>\n",
       "      <td>251</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>1500100010</td>\n",
       "      <td>羿彦昌</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>402</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1500100991</td>\n",
       "      <td>冉飞昂</td>\n",
       "      <td>理科一班</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1500100992</td>\n",
       "      <td>莫运盛</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>407</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1500100993</td>\n",
       "      <td>衡从蕾</td>\n",
       "      <td>理科二班</td>\n",
       "      <td>386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>1500100994</td>\n",
       "      <td>相凌青</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1500100995</td>\n",
       "      <td>寿芷卉</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>227</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>355</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>1500100998</td>\n",
       "      <td>容昆宇</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>398</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>379</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            id name clazz  sum_score\n",
       "0   1500100001  施笑槐  文科六班        406\n",
       "1   1500100002  吕金鹏  文科六班        440\n",
       "2   1500100003  单乐蕊  理科六班        359\n",
       "3   1500100004  葛德曜  理科三班        421\n",
       "4   1500100005  宣谷芹  理科五班        395\n",
       "5   1500100006  边昂雄  理科二班        314\n",
       "6   1500100007  尚孤风  文科六班        418\n",
       "7   1500100008  符半双  理科六班        363\n",
       "8   1500100009  沈德昌  理科一班        251\n",
       "9   1500100010  羿彦昌  理科六班        402\n",
       "10  1500100991  冉飞昂  理科一班         76\n",
       "11  1500100992  莫运盛  理科六班        407\n",
       "12  1500100993  衡从蕾  理科二班        386\n",
       "13  1500100994  相凌青  理科四班        310\n",
       "14  1500100995  寿芷卉  理科五班        227\n",
       "15  1500100996  厉运凡  文科三班        355\n",
       "16  1500100997  陶敬曦  理科六班        293\n",
       "17  1500100998  容昆宇  理科四班        398\n",
       "18  1500100999  钟绮晴  文科五班        371\n",
       "19  1500101000  符瑞渊  理科六班        379"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 类似union\n",
    "pd.concat([stu_sum_score_10,stu_sum_score_10_tail]).reset_index().drop('index',axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "8066ee9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# topN\n",
    "# 班级前三名\n",
    "# method{‘average’, ‘min’, ‘max’, ‘first’, ‘dense’}, default ‘average’\n",
    "\n",
    "stu_sum_score['avg_rank'] = stu_sum_score.groupby('clazz')['sum_score'].rank(method='average',ascending=False)\n",
    "# rank\n",
    "stu_sum_score['min_rank'] = stu_sum_score.groupby('clazz')['sum_score'].rank(method='min',ascending=False)\n",
    "stu_sum_score['max_rank'] = stu_sum_score.groupby('clazz')['sum_score'].rank(method='max',ascending=False)\n",
    "# row_number\n",
    "stu_sum_score['first_rank'] = stu_sum_score.groupby('clazz')['sum_score'].rank(method='first',ascending=False)\n",
    "# dense_rank\n",
    "stu_sum_score['dense_rank'] = stu_sum_score.groupby('clazz')['sum_score'].rank(method='dense',ascending=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "3edcc2d3",
   "metadata": {},
   "outputs": [],
   "source": [
    "clazz_top3 = stu_sum_score[stu_sum_score['max_rank']<=3].sort_values(['clazz','max_rank'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "695930d2",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 柱状图\n",
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# windows解决中文乱码\n",
    "plt.rcParams['font.sans-serif']=['SimHei'] # 用来正常显示中文标签\n",
    "\n",
    "# mac解决中文乱码\n",
    "# plt.rcParams['font.sans-serif'] = ['Arial Unicode MS']\n",
    "\n",
    "plt.rcParams['axes.unicode_minus']=False # 用来正常显示负号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "a00841c8",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "tips = sns.load_dataset(\"tips\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "bfe69d98",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "print(type(tips))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "fc0e53ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>total_bill</th>\n",
       "      <th>tip</th>\n",
       "      <th>sex</th>\n",
       "      <th>smoker</th>\n",
       "      <th>day</th>\n",
       "      <th>time</th>\n",
       "      <th>size</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>16.99</td>\n",
       "      <td>1.01</td>\n",
       "      <td>Female</td>\n",
       "      <td>No</td>\n",
       "      <td>Sun</td>\n",
       "      <td>Dinner</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10.34</td>\n",
       "      <td>1.66</td>\n",
       "      <td>Male</td>\n",
       "      <td>No</td>\n",
       "      <td>Sun</td>\n",
       "      <td>Dinner</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>21.01</td>\n",
       "      <td>3.50</td>\n",
       "      <td>Male</td>\n",
       "      <td>No</td>\n",
       "      <td>Sun</td>\n",
       "      <td>Dinner</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>23.68</td>\n",
       "      <td>3.31</td>\n",
       "      <td>Male</td>\n",
       "      <td>No</td>\n",
       "      <td>Sun</td>\n",
       "      <td>Dinner</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>24.59</td>\n",
       "      <td>3.61</td>\n",
       "      <td>Female</td>\n",
       "      <td>No</td>\n",
       "      <td>Sun</td>\n",
       "      <td>Dinner</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   total_bill   tip     sex smoker  day    time  size\n",
       "0       16.99  1.01  Female     No  Sun  Dinner     2\n",
       "1       10.34  1.66    Male     No  Sun  Dinner     3\n",
       "2       21.01  3.50    Male     No  Sun  Dinner     3\n",
       "3       23.68  3.31    Male     No  Sun  Dinner     2\n",
       "4       24.59  3.61  Female     No  Sun  Dinner     4"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tips.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "e3683eb6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='day', ylabel='total_bill'>"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAECCAYAAAAfE3cCAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAANgUlEQVR4nO3dfaxlVX3G8e/j4EQYCELnBmRSHVOprY1Aw6RFXmTUTqWm/QNtQVuwtJJJQzRpSaGhEhUSo6EJtNWKnQQRDEqskZYqQmhkkAK+3GmCJSmkNnGAsZMOKgxQVF5+/ePsKcPlzr1n7pyzzz13fT/Jzd77nH1m/bIy95k9a6+9TqoKSdLK9rJJFyBJGj/DXpIaYNhLUgMMe0lqgGEvSQ04aNIFzGft2rW1fv36SZchSVNl27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5P8HPBtBkve+oukZc2wl5Ygya8A1wJ/X1XXTLoeaTGGvSQ1wDF7SWqAYS9JDTDsJakBhr0kNcCwl6QG/B9TSE7Jp6LfcAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.barplot(x=\"day\", y=\"total_bill\", data=tips)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "68dd8454",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAA64AAAG4CAYAAABFFrrdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAu6UlEQVR4nO3dfdxlZV0v/s/XmVGQByVAO0Iw6iG1H4jKKJwZyAFBzYeSUqw8geU5dNRIs0NZKkc5EiX9SkOsUNQgJS3xsURBHGFQ0pl0QEnTTAhFmuRBIBCE7/lj76GbYWa4YfaeWfc97/frtV+z77XWvta1v7PnXvPZ11rXqu4OAAAADNUDtnYHAAAAYFMEVwAAAAZNcAUAAGDQBFcAAAAGTXAFAABg0ARXALifquqhm1h3eFXtdR/b+5Wqet2Mn7evqkuqarfN6Ob6+3jGpvoNAENUbocDAJtWVTsleWKSO5MsTHJpd19bVRcl+fMk3x+vW5DkH5J8e/znLyR5eJI3J9k5yXeSLErygO5+8gb2s2uSdyZ5fnffXlWvSLJ3d79qve2em+SsJDdtpMs7JTmyuy9Y73X7JPlMkqd091X3tQ4AsLUs3NodAIA54IFJ9kxySpJXJXnQeHknuTKjUHpikl9P8oMkv5zko0luTrJfkmckOaO7n1NVz0ry/HUNV9XxSf5HRiF03bfJn6uqJNkuyW1VtSrJDkn+rrt/s7s/muSh9+UNVNV2Sd6TZG2SD43bT5K9k6xM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Xe/K61//+tx+++1ZuXJlbrjhhpx77rl3vf4rX/lKjjvuuHz4wx/OTjvttFk1EFwBAAAG7BWveEX233//rFixIq9//es3ut0ll1ySX//1X88pp5ySJLn88svzgAc8IBdeeGHOPffc3HTTTTn55JPzmMc8Jkny4he/eJP7Xb+9q6++Oi9/+ctz+OGH55nPfGauueaaJMk3vvGNfOYzn8mb3vSmXHDBBXdt+6IXvSjnnnvuZofWxDWuAAAA88K+++6bn/3Zn73r5yc96UnZd9998/SnPz0f/ehH8+AHP3iz2lu0aFHe8Y535EUvelGuvfba3HLLLUmSo48+OknysIc9LLfddluS5K1vfWv23HPPXHHFFZv7tpIIrgAAAPPCjjvueLef16xZk2XLluWTn/xkrrvuulx00UVJku233z7/8R//kSTp7lm3d8YZZ+T5z39+zj777Oywww53LZ/5fJ3Xve51edvb3pbXve519/v9zCS4AgAAzEOLFy/On/zJn2Tp0qX57ne/myVLliRJjjjiiJxzzjlZtmzZXWF2No444oicfPLJOeyww5Ik3/72tze67XbbbZe99torj33sY/ORj3xk895IktpUwh6aJUuW9KpVq7Z2NwAAAKbiH//xH/O4xz1ua3dj6jb0PqtqdXcv2dD2JmcCAADYhi1fvvxuPz/kIQ/Jhz/84a3TmY0QXAEAALZhM2+pM1SucQUAAGDQBFcAAAAGTXAFAABg0FzjCgAAMEcccPyZE21v9SlHT7S9aTHiCgAAwCZdc801OeSQQza6/vbbb89znvOcLF26NO985zsnvn/BFQAAgI267rrrcswxx+Tmm2/e6DannnpqlixZks9+9rP52Mc+lhtvvHGifRBcAQAA2KgFCxbkfe97X3beeeeNbrNixYocddRRSZKlS5dm1apVE+2Da1wBAADYqE0F1nVuvvnm7LHHHndtf80110y0D0ZcAQAA2Cw77rhjbrnlliTJTTfdlDvvvHOi7QuuAAAAbJYDDjggK1euTJKsWbMmixcvnmj7ThUGAACYI4Zw+5oLLrggl19+eX7t137trmXHHHNMnvWsZ+Wiiy7K5ZdfngMPPHCi+zTiCgAAwL1asWJFkuSwww67W2hNkr333jvnnXdeli1blvPPPz8LFiyY6L6NuAIAALDZHvGIR9w1s/CkGXEFAABg0ARXAAAABk1wBQAAYNBc4woAADBHXHnifhNtb68TLptoe9NixBUAAIANuuGGG/JTP/VTOeKII3LkkUfmtttu2+B2L3nJS7J06dK88Y1vnEo/jLgCAPPaAcefOdH2hnAPRYAt5T3veU9e9apX5YgjjshLX/rSnHvuufnpn/7pu21zzjnn5I477shnP/vZvOxlL8vXv/717LPPPhPth+AKAADABr3sZS+76/natWvzsIc97B7brFix4q7b4Bx22GFZuXLlxIOrU4UBAADYpM997nO57rrrctBBB91j3c0335w99tgjSbLzzjvnmmuumfj+jbgCAACwUddee22OO+64fOADH9jg+h133DG33HJLkuSmm27KnXfeOfE+zJvg6voVAAC2hEn+v9P/ORm62267LUcddVROPvnk7L333hvc5oADDsjKlStz0EEHZc2aNXnMYx4z8X7Mm+AKAAAw323p29ecccYZWb16dU466aScdNJJOfTQQ3P77bffbfbg5z3veTnkkEPyne98Jx//+MdzySWXTLwfgisAAAAb9NKXvjQvfelLN7nNzjvvnBUrVuS8887Lb/3Wb+UhD3nIxPsx1eBaVW9L8vEkFyb5q/H+bkrywiR3Jvnm+JEkx3X33Lj7LQAAAHfZZZdd7ppZeBqmNqtwVR2S5Ee7+6NJXpTkj7r7iCTfTfLMJI9PcnZ3Lx8/hFYAAADuYSrBtaoWJXl7km9V1c9099u6+7zx6t2T/FuSg5IcWVUrq+o9VeW0ZQAAAO5hWiOuRye5PMmbkjylqo5Lkqr6b0l26e5LknwhyVO7++Ak1yd51oYaqqpjq2pVVa1au3btlLoLAADAUE1rlPOJSU7v7u9W1V8mOamq3pPk1CQ/N97m0u7+wfj5V5Pss6GGuvv0JKcnyZIlS3pK/QUAABi8Zacum2h7Fx938b1uc+2112b16tV54hOfmN12222i+5+taY24fiPJo8bPlyS5Isn7k/xOd18xXn5WVe1fVQuSHJlkzZT6AgAAwP1w9dVX59nPfnY+//nP59BDD83GzoJ9yUtekqVLl97tNjmTNK3g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tnvZbmGSO2dOyFRVC7r7jmn3EQC2NsEVAACAQXOqMAAAAIMmuAIAADBogisAAACDJrgCAAAwaIIrAAAAg/b/AB64Nfvda72RAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1152x504 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 设置画布大小\n",
    "plt.figure(figsize=(16,7))\n",
    "plt.title(\"班级前三名\")\n",
    "sns.barplot(x='clazz',y='sum_score',hue='first_rank',data=clazz_top3)\n",
    "plt.xlabel(\"班级\")\n",
    "plt.ylabel(\"总分\")\n",
    "plt.ylim([450,650])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "bd937f27",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='clazz', ylabel='sum_score'>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEECAYAAADHzyg1AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAeTUlEQVR4nO3deZgU1bnH8e/LCIIMKsIERVRccEURHREBFRfiEg3qdYEYF0RRYhY1McZgjEn0ut1E43pFgbgrilsUNSIQUa4IuBIRvRoX9KIDAgMIivLeP05N0TPTPdMzUzXdDL/P88wz3aeq6z3VXd1vn3OqTpu7IyIiAtCq0BUQEZHioaQgIiIxJQUREYkpKYiISExJQUREYkoKIiIS26DQFchH586dvXv37oWuhojIOmX27NkL3b2sIY9ZJ5JC9+7dmTVrVqGrISKyTjGzjxr6GHUfiYhITElBRERiSgoiIhJTUhARkZiSgoiIxJQUREQkpqQgIiIxJQUREYmtExeviUhte194V53LZ197ajPVRFqSdS4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Gp7hzDrKoSpIc7Mss5w4GFgKLAC4hksbyXMT/NtrjKRYqakIFLbaMJ8W1MJcyndnWWd5wi/1zA5ur8l8BOgG3BvNIZwYI4ykaKlK5pFRCSmloKIiMSUFEREJKakICIiMSUFERGJKSmIiEhMSUFERGJKCiIiEvt/aRPFWzaj3aAAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.barplot(x='clazz',y='sum_score',hue='first_rank',data=clazz_top3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "bdfda7c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "stu_sum_score_df = stu_sum_score[['id','name','clazz','sum_score']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "49041e8d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>clazz</th>\n",
       "      <th>sum_score</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1500100001</td>\n",
       "      <td>施笑槐</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>406</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1500100002</td>\n",
       "      <td>吕金鹏</td>\n",
       "      <td>文科六班</td>\n",
       "      <td>440</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1500100003</td>\n",
       "      <td>单乐蕊</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1500100004</td>\n",
       "      <td>葛德曜</td>\n",
       "      <td>理科三班</td>\n",
       "      <td>421</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1500100005</td>\n",
       "      <td>宣谷芹</td>\n",
       "      <td>理科五班</td>\n",
       "      <td>395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>1500100996</td>\n",
       "      <td>厉运凡</td>\n",
       "      <td>文科三班</td>\n",
       "      <td>355</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>1500100997</td>\n",
       "      <td>陶敬曦</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>293</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>1500100998</td>\n",
       "      <td>容昆宇</td>\n",
       "      <td>理科四班</td>\n",
       "      <td>398</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>1500100999</td>\n",
       "      <td>钟绮晴</td>\n",
       "      <td>文科五班</td>\n",
       "      <td>371</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>1500101000</td>\n",
       "      <td>符瑞渊</td>\n",
       "      <td>理科六班</td>\n",
       "      <td>379</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             id name clazz  sum_score\n",
       "0    1500100001  施笑槐  文科六班        406\n",
       "1    1500100002  吕金鹏  文科六班        440\n",
       "2    1500100003  单乐蕊  理科六班        359\n",
       "3    1500100004  葛德曜  理科三班        421\n",
       "4    1500100005  宣谷芹  理科五班        395\n",
       "..          ...  ...   ...        ...\n",
       "995  1500100996  厉运凡  文科三班        355\n",
       "996  1500100997  陶敬曦  理科六班        293\n",
       "997  1500100998  容昆宇  理科四班        398\n",
       "998  1500100999  钟绮晴  文科五班        371\n",
       "999  1500101000  符瑞渊  理科六班        379\n",
       "\n",
       "[1000 rows x 4 columns]"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_sum_score_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "fe01db61",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 存文件\n",
    "stu_sum_score_df.to_csv(\"../data/stu_sum_score.csv\",encoding='utf8',index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "9e9ada40",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 1000 entries, 0 to 999\n",
      "Data columns (total 4 columns):\n",
      " #   Column     Non-Null Count  Dtype \n",
      "---  ------     --------------  ----- \n",
      " 0   id         1000 non-null   int64 \n",
      " 1   name       1000 non-null   object\n",
      " 2   clazz      1000 non-null   object\n",
      " 3   sum_score  1000 non-null   int64 \n",
      "dtypes: int64(2), object(2)\n",
      "memory usage: 71.4+ KB\n"
     ]
    }
   ],
   "source": [
    "stu_sum_score_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "09da3766",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 存数据库\n",
    "from sqlalchemy import create_engine\n",
    "engine = create_engine(\"mysql+pymysql://{}:{}@{}/{}\".format('root', '123456', 'master:3306', 'db1'))\n",
    "con = engine.connect()\n",
    "\n",
    "stu_sum_score_df.to_sql(name='stu_sum_score', con=con, if_exists='append', index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd8615cd",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
